package demo1;

import java.util.Scanner;
class Animal {
    public Animal (){
        System.out.println("父类的构造方法");
        func();
    }
    public void func () {
        System.out.println("父类的func 方法");
    }
}
class Cat extends Animal{
    private int nums = 1;
    public Cat () {
        super();
        System.out.println("子类的构造方法");
    }

    @Override
    public void func() {
        System.out.println("子类重写父类的func 方法" + nums);
    }
}
public class Test {
    public static void main(String[] args) {
        Animal animal = new Cat();
        //父类的构造方法
        //子类重写父类的func 方法0
        //子类的构造方法
        Scanner input = new Scanner(System.in);
    }
}
